package com.hc.map;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.hc.bean.BaseStationBean;

public class MapNet implements Serializable {
	private int netId;
	private List<BaseStationBean> bases = new ArrayList<BaseStationBean>();
	
	public MapNet(){
		
	}
	
	public MapNet(int netId){
		this.netId = netId;
	}
	
	public int getNetId() {
		return netId;
	}

	public void setNetId(int netId) {
		this.netId = netId;
	}

	public void addBaseStation(BaseStationBean base){
		for(BaseStationBean bean : bases){
			if(bean.getId() == base.getId()){
				return;
			}
		}
		bases.add(base);
	}
	
	public void deleteBaseStation(int baseId){
		for(Iterator<BaseStationBean> it = bases.iterator(); it.hasNext();){
			BaseStationBean bean = it.next();
			if(baseId == bean.getId()){
				it.remove();
			}
		}
	}
	
	public BaseStationBean getBaseById(int baseId){
		for(BaseStationBean bean : bases){
			if(baseId == bean.getId()){
				return bean;
			}
		}
		return null;
	}

	public List<BaseStationBean> getBases() {
		return bases;
	}

	public void setBases(List<BaseStationBean> bases) {
		this.bases = bases;
	}
}
